<%@page import="com.tox.dao.pojo.JavatoxUser"%>
<%@page import="org.json.simple.JSONObject"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	JavatoxUser user=null;
	int uid=0;
			if(request.getSession().getAttribute("user")!=null){
			 user=(JavatoxUser)request.getSession().getAttribute("user");		
				uid=user.getId();
			}
	
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="view/toastr/toastr.min.css" rel="stylesheet">
<link href="view/bootstrap/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="view/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript" src="view/toastr/toastr.js"></script>
<link href="view/css/oneplus.css" rel="stylesheet">
<link href="view/css/weibo.css" rel="stylesheet">
<script type="text/javascript" src="view/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="view/js/tox.js"></script>

</head>

<body style="background-color:F1F1F1">
	<div id="top_bar" class="top_bar">
		<div class="container">
			<div class="row">
				<div class="col-md-6 col-sm-6 hidden-xs">
					分享<a class="share_weibo" id="weibo_shareBtn" target="_blank"
						href="http://service.weibo.com/share/share.php?url=http://www.thinkox.com/tox/weibo&amp;appkey=&amp;title=ThinkOX微博&amp;pic=&amp;ralateUid=1971549283&amp;language=zh_cn"></a>

				</div>
				<div class="col-md-6 col-xs-12  text-right top_right">

					<ul class="nav navbar-nav navbar-right">
						<s:if test="#session.user!=null">
							<!--登陆面板-->
							<li class="dropdown op_nav_ico hidden-xs hidden-sm">
								<div></div> <a id="nav_info" class="dropdown-toggle text-left"
								data-toggle="dropdown"> <span
									class="glyphicon glyphicon-bell"></span> <span
									id="nav_bandage_count" class="badge pull-right">66</span>
									&nbsp; </a>
								<ul class="dropdown-menu extended notification">
									<li style="padding-left: 15px;padding-right: 15px;">
										<div class="row nav_info_center">
											<div class="col-xs-9 nav_align_left">
												<span id="nav_hint_count">66</span> 条未读
											</div>
											<div class="col-xs-3">
												<i onclick="setAllReaded()"
													class="set_read glyphicon glyphicon-ok" title="全部标为已读"></i>
											</div>
										</div></li>
									<li>
										<div
											style="position: relative;width: auto;overflow: hidden;max-height: 250px ">
											<div class="slimScrollDiv"
												style="position: relative; overflow: hidden; width: auto; height: 150px;">
												<ul id="nav_message" class="dropdown-menu-list scroller "
													style="width: auto; overflow: hidden; height: 150px;">

												</ul>
												<div class="slimScrollBar"
													style="width: 7px; position: absolute; top: 0px; opacity: 0.4; display: block; border-top-left-radius: 7px; border-top-right-radius: 7px; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; z-index: 99; right: 1px; background: rgb(0, 0, 0);"></div>
												<div class="slimScrollRail"
													style="width: 7px; height: 100%; position: absolute; top: 0px; display: none; border-top-left-radius: 7px; border-top-right-radius: 7px; border-bottom-right-radius: 7px; border-bottom-left-radius: 7px; opacity: 0.2; z-index: 90; right: 1px; background: rgb(51, 51, 51);"></div>
											</div>
										</div></li>
									<li class="external"><a href="/tox/ucenter/msg"> 消息中心
											<i class="glyphicon glyphicon-circle-arrow-right"></i> </a></li>
								</ul></li>
							<li><a style="margin-right: 15px;" title="修改资料"
								href="/tox/ucenter/conf"><i class="glyphicon glyphicon-cog"></i>
							</a></li>
							<!-- 是否登录状态的显示区 -->
							<li class="top_spliter hidden-xs"></li>

							<li class="dropdown"><a role="button"
								class="dropdown-toggle dropdown-toggle-avatar"
								data-toggle="dropdown"><s:property
										value="#session.user.nickname" /> &nbsp;<i
									style="font-size: 12px"
									class="glyphicon glyphicon-chevron-down"></i> </a>
								<ul class="dropdown-menu text-left" role="menu">
									<li><a href="/tox/ucenter"><span
											class="glyphicon glyphicon-user"></span>&nbsp;&nbsp;个人主页</a></li>
									<li><a href="/tox/ucenter/collection"><span
											class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;我的收藏</a></li>
									<li><a href="logout.action" event-node="logout"><span
											class="glyphicon glyphicon-off"></span>&nbsp;&nbsp;注销</a></li>
								</ul></li>
						</s:if>
						<s:else>
							<li class="hidden-xs"><a
								href="${pageContext.request.contextPath}/home/login.jsp">登录</a>
							</li>
							<li class="hidden-xs"><a
								href="${pageContext.request.contextPath}/home/register.jsp">注册</a>
							</li>
						</s:else>
						<li class="top_spliter hidden-xs"></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<div id="logo_bar" class="logo_bar" style="background: #03AE87">
		<div class="container">
			<div class="row logo">
				<div class="col-md-9">
					<a href="/tox/home/index/index.html"><img
						src="http://www.thinkox.com/tox/Public/Core/images/logo.png">
					</a>
				</div>
				<div class="col-md-3 hidden-xs">
					<div class="pull-right text-right" style="padding-top:4px;">
						<form class="navbar-form navbar-right search_bar" role="search"
							id="forum_search" method="post" action="/tox/weibo/search">
							<div class="form-group">
								<div class="input-group">
									<input type="text" class="form-control" name="keywords"
										placeholder="查找">

									<div class="input-group-btn text-left">
										<button type="button" class="btn btn-default dropdown-toggle"
											style="height:34px;border-left: none;border-top-left-radius: 0;border-bottom-left-radius: 0"
											data-toggle="dropdown">
											<span class="glyphicon glyphicon-search"></span>
										</button>
										<ul class="dropdown-menu pull-right" role="menu">
											<li><a class="submit_search weibo_search"
												url="/tox/weibo/search">微博</a></li>
											<li><a class="submit_search" url="/tox/forum/search">论坛</a>
											</li>
											<!-- <li><a class="submit_search">活动</a></li>-->
											<li><a class="submit_search" url="/tox/people/find">会员</a>
											</li>
										</ul>
									</div>
								</div>
							</div>
						</form>
					</div>
				</div>

			</div>
		</div>
	</div>
	<div id="nav_bar" class="nav_bar" style="margin-bottom: 25px;">
		<nav class="container" id="nav_bar_container" role="navigation">
		<div class="collapse navbar-collapse " id="nav_bar_main">

			<ul class="nav navbar-nav  " style="font-size: 16px">
				<li class=""><a href="/tox/home/index/index.html"
					target="_self" style="color:">首页</a>
				</li>

			</ul>

		</div>

		<!--导航栏菜单项-->

		<div class="row visible-xs">
			<div class="navbar-header col-xs-3 pull-right text-left">
				<button type="button" class="navbar-toggle" data-toggle="collapse"
					data-target="#nav_bar_main">
					<span class="sr-only">Toggle navigation</span> <span
						class="icon-bar"></span> <span class="icon-bar"></span> <span
						class="icon-bar"></span>
				</button>
			</div>
		</div>


		</nav>
	</div>
	<div id="main-container" class="container" style="min-height:612px;">
		<div class="row">
			<div class="weibo_left col-md-9">
				<s:if test="#session.user!=null">
					<div class="row">
						<div class="col-xs-12">
							<div class="col-md-2 col-sm-2 col-xs-12 text-center"
								style="position: relative">
								<a class="s_avatar" href="/tox/ucenter/79.html" ucard="79"
									data-hasqtip="22" aria-describedby="qtip-22"> <img
									src="http://www.thinkox.com/tox/Uploads/Avatar/2014-03-21/532c069db0597-39961ec0_128_128.png"
									class="avatar-img" style="width: 64px;"> </a> <br>
								<!--  筛选部分-->
								<div id="weibo_filter" style="margin-top:15px;">
									<div class="btn-group forum_order">
										<button type="button" class="btn btn-default dropdown-toggle"
											data-toggle="dropdown">
											全站动态 <span class="caret"></span>
										</button>
										<ul class="dropdown-menu text-left" role="menu">
											<li><a href="/tox/weibo">全站动态</a></li>
											<li><a href="/tox/weibo/concerned">我的关注</a></li>
										</ul>
									</div>
								</div>
								<script>
									/*                    $('#nav_bar_container').append( $('#weibo_filter'));*/
								</script>

								<!--筛选部分结束-->
							</div>
							<div class="col-md-10 col-sm-8 col-xs-12">
								<div class="weibo_content weibo_post_box">
									<div class="weibo_content_sj pull-left hidden-xs"></div>
									<p class="pull-left">
										<small class="font_grey">【Lv4 程序员 】</small> <a ucard="79"
											href="/tox/ucenter/79.html" class="user_name"
											data-hasqtip="23"> 小泽玛丽罗 </a>
									</p>
									<div class="pull-right show_num_quick">还可以输入200个字</div>
									<div class="weibo_content_p">
										<div class="row">
											<div class="col-xs-12">
												<p>
													<textarea class="form-control weibo_content_quick"
														id="weibo_content" name="content" style="height: 6em;"
														placeholder="写点什么吧～～"></textarea>
												</p>
												<a href="javascript:" onclick="insertFace($(this))"><img
													class="weibo_type_icon"
													src="http://www.thinkox.com/tox/Public/static/image/bq.png">
												</a>


												<link type="text/css" rel="stylesheet"
													href="http://www.thinkox.com/tox/Addons/InsertImage/_static/css/insertImage.css">

												<a href="javascript:" id="insert_image"
													onclick="insert_image.insertImage(this)"><img
													class="weibo_type_icon"
													src="http://www.thinkox.com/tox/Addons/InsertImage/_static/image/image.png">
												</a> <input type="hidden" id="box_url"
													value="http://www.thinkox.com/tox/home/addons/execute/_addons/insert_image/_controller/insert_image/_action/imagebox.html">

												<!--
<a href="javascript:" onclick="insert_image.insertImage($(this))"><span class="glyphicon glyphicon-picture" ></span></a>-->
												<p class="pull-right">
													<input id="sendWeibo" type="submit" value="发表 Ctrl+Enter"
														class="btn btn-primary send_weibo_button">
												</p>
											</div>
										</div>
										<div id="emot_content" class="emot_content"></div>
										<div id="hook_show" class="emot_content"></div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</s:if>
				<div id="weibo_list">
					<s:iterator value="weiboList">

						<div class="row" id=<s:property value="id"/>>
							<div class="col-xs-12">
								<div class="col-md-2 col-sm-2 col-xs-12 text-center"
									style="position: relative">
									<a class="s_avatar" href="/tox/ucenter/2.html" ucard="2"
										data-hasqtip="26"> <img
										src="http://www.thinkox.com/tox/Uploads/Avatar/2014-03-21/532c069db0597-39961ec0_128_128.png"
										class="avatar-img" style="width: 64px;"> </a>
								</div>
								<div class="col-md-10 col-sm-8col-xs-12">
									<div class="weibo_content" id="weibo_content1">
										<div class="weibo_content_sj pull-left hidden-xs"></div>


										<p>
											<small class="font_grey">【 <s:property
													value="user.level" /> 】</small><a ucard="2530"
												href="/tox/ucenter/2530.html" class="user_name"
												data-hasqtip="33"><s:property value="user.nickname" />
											</a> <span class="usercenter-verify-icon-list"></span>

										</p>
										<div class="weibo_content_p">
											<p class="word-wrap">
												<s:property value="content" />
											</p>
										</div>

										<div class="row weibo-comment-list" style="display: none;"
											data-weibo-id="5297">
											<div class="col-xs-12">
												<div class="light-jumbotron" style="padding: 1em 2em;">
													<div class="weibo-comment-container"></div>
												</div>
											</div>
										</div>
										<div class="weibo_content_bottom row">
											<!--"/tox/bboard/index/tmldetail.html"-->

											<div class="col-md-6">
												<span><a href="/tox/weibo/detail_5297.html"><s:property
															value="createTime" /> </a> </span> &nbsp;&nbsp;<span>来自 网站端
												</span>

											</div>
											<div class="col-md-6">
												<span class="pull-right" data-weibo-id=<s:property value="id" /> > <a
													title="喜欢" onclick="likeWeibo()"  value="<%=uid %>" row="<s:property value="id"/>" class="support_btn" table="weibo" 
													uid=<s:property value="user.id"/> jump=""> <i id="ico_like"
														class="support_nolike"></i> </a><span
													id="support_Weibo_weibo_5513_pos"><span
														id="support_Weibo_weibo_5513">0</span> </span> <a title="转发"
													class="send_repost"
													href="/tox/weibo/index/sendrepost/sourseId/5513/weiboId/5513.html"
													style="margin-left:8px ">转发 0</a>    <span
													class="weibo-comment-link cpointer" data-weibo-id=<s:property value="id" />>
														评论 0</span> </span>
											</div>

										</div>
									</div>
								</div>
							</div>
						</div>
					</s:iterator>

				</div>
			</div>
			<div class="weibo_right col-md-3"></div>
		</div>
	</div>

</body>
<script type="text/javascript">
	$(document).ready(

	$("#sendWeibo").click(function() {
		
		var content = $("#weibo_content").val().trim();
		var params = $("#weibo_content").serialize();
		$.ajax({
			type : "post",
			data : params,
			url : "sendWeibo.action",
			success : function(data) {
				var jsonObject = eval("(" + data + ")");
				if (jsonObject["success"]) {
					toast.success("发送成功", "温馨提示");
					var weibo = jsonObject["weibo"];
					var user = weibo.user;
					addWeibo(jsonObject["weibo"]);
					$("#weibo_content").val("");
					
				} else {
					toast.warning("对不起，发送失败", "温馨提示");
				}
			},
			error : function() {

			}

		});

	}));
	function addWeibo(weibo) {
		var weiboItem = "<div class=\"row\" id="+weibo.id+">"
				+ "<div class=\"col-xs-12\">"
				+ "<div class=\"col-md-2 col-sm-2 col-xs-12 text-center\""+
									"style=\"position:relative\">"
				+ "<a class=\"s_avatar\" href=\"/tox/ucenter/2.html\" ucard=\"2\" "+
										"data-hasqtip=\"26\"> <img src=\"http://www.thinkox.com/tox/Uploads/Avatar/2014-03-21/532c069db0597-39961ec0_128_128.png\""+
										"class=\"avatar-img\" style=\"width: 64px;\"> </a>"
				+ "</div>" + "<div class=\"col-md-10 col-sm-8col-xs-12\">"
				+ "<div class=\"weibo_content\" id=\"weibo_content1\">"
				+ "<div class=\"weibo_content_sj pull-left hidden-xs\"></div>" +

				"<p>" + "<small class=\"font_grey\" >" + "【 "
				+ weibo.user.level
				+ " 】"
				+ "</small><a ucard=\"2530\""+
												"href=\"/tox/ucenter/2530.html\" class=\"user_name\""+
												"data-hasqtip=\"33\">"
				+ weibo.user.nickname
				+ "</a> <span class=\"usercenter-verify-icon-list\"></span>"
				+

				"</p>"
				+ "<div class=\"weibo_content_p\">"
				+ "<p class=\"word-wrap\">"
				+ weibo.content
				
				+ "</p>"
				+ "</div>"
				+

				"<div class=\"row weibo-comment-list\" style=\"display: none;\""+
											"data-weibo-id=\"5297\">"
				+ "<div class=\"col-xs-12\">"
				+ "<div class=\"light-jumbotron\" style=\"padding: 1em 2em;\">"
				+ "<div class=\"weibo-comment-container\"></div>"
				+ "</div>"
				+ "</div>"
				+ "</div>"
				+ "<div class=\"weibo_content_bottom row\">"
				+

				"<div class=\"col-md-6\">"
				+ "<span><a href=\"/tox/weibo/detail_5297.html\">"
				+ weibo.createTime
				+ " </a> </span> &nbsp;&nbsp;<span>来自 网站端"
				+ "</span>"
				+

				"</div>"
				+ "<div class=\"col-md-6\">"
				+ "<span class=\"pull-right\" data-weibo-id=\"5513\">"
				+ "<a title=\"喜欢\" class=\"support_btn\" table=\"weibo\" row=\"5513\" uid=\"2327\" jump=\"\"> <i id=\"ico_like\""
				+"class=\"support_nolike\"></i> </a><span id=\"support_Weibo_weibo_5513_pos\"><span id=\"support_Weibo_weibo_5513\">0</span> </span> <a title=\"转发\" class=\"send_repost\" href=\"/tox/weibo/index/sendrepost/sourseId/5513/weiboId/5513.html\""
				+"style=\"margin-left:8px \">转发 0</a>&nbsp;&nbsp;&nbsp; <span class=\"weibo-comment-link cpointer\" data-weibo-id=\"5513\">"
				+ "评论 0 "+"</span> </span>" + "</div>" +

				"</div>" + "</div>" + "</div>" + "</div>" + "</div>";

		$(weiboItem).prependTo("#weibo_list");
	}
</script>
</html>
